package com.zhiwang.xiaoqu.ui.my

import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import com.zhiwang.xiaoqu.R
import com.zhiwang.xiaoqu.di.annotation.Injectable
import com.zhiwang.xiaoqu.di.component.DaggerUserComponent
import com.zhiwang.xiaoqu.di.module.AutoDisposeModule
import com.zhiwang.xiaoqu.ktextension.setImmersive
import com.zhiwang.xiaoqu.mvp.presenter.SmsPresenter
import com.zhiwang.xiaoqu.mvp.presenter.UserPresenter
import com.zhiwang.xiaoqu.ui.BaseActivity
import com.zhiwang.xiaoqu.ui.about.ServiceActivity
import kotlinx.android.synthetic.main.activity_change_phone.*
import quickStartActivity
import javax.inject.Inject

class ChangePhoneActivity : BaseActivity(),Injectable {

    //更换手机号，第一步，第二部

    //绑定手机号

    companion object SOUL {

        /**
         * [isBindPhone] true ：绑定手机号，false 修改手机号
         */
        fun start(context: Context, isBindPhone: Boolean) {
            val intent = Intent(context, ChangePhoneActivity::class.java)
            intent.putExtra("isBindPhone", isBindPhone)
            context.startActivity(intent)
        }
    }

    var isBindPhoneAction = false

    @Inject
    lateinit var userPresenter: UserPresenter

    @Inject
    lateinit var smsPresenter: SmsPresenter

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        window.setImmersive(Color.TRANSPARENT, true)
        setContentView(R.layout.activity_change_phone)
        setSupportActionBar(toolbar)
        isBindPhoneAction = intent.getBooleanExtra("isBindPhone", false)


        observeTextChangeWithTargetButtonEnableStatus(arrayOf(et_graphcode, et_sms, et_phone), tv_next)

        contact_custom_service.setOnClickListener {
            quickStartActivity(ServiceActivity::class.java)
        }
    }

    override fun onSupportNavigateUp(): Boolean {
        onBackPressed()
        return true
    }
}
